#include <iostream>
#include <cstring>
#include <queue>

using namespace std;
struct node
{
	int x, y;
};
char g[10000][10000];
int dist[10000][10000];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

void bfs()
{
	memset(dist, -1, sizeof dist);
	queue<node> q;
	q.push({3000, 3000}); dist[3000][3000] = 0;
	q.push({5020, 3011}); dist[5020][3011] = 0;
	q.push({3011, 3014}); dist[3011][3014] = 0;
	q.push({5000, 5000}); dist[5000][5000] = 0;
		
	while(q.size())
	{
		node t = q.front();
		q.pop();
		
		if(dist[t.x][t.y] == 2020) return;
		
		for (int i = 0; i < 4; i ++)
		{
			int a = t.x + dx[i], b = t.y + dy[i];
			if(a < 0 || a > 10000 || b < 0 || b > 10000) continue;
			if(g[a][b] == '*' || dist[a][b] != -1) continue;
			g[a][b] = '*';
			q.push({a, b});
			dist[a][b] = dist[t.x][t.y] + 1;
		}
	}	
}

int main()
{
	for (int i = 0; i < 10000; i ++)
		for (int j = 0; j < 10000; j ++)
			g[i][j] = '.';
			
	g[3000][3000] = '*';
	g[5020][3011] = '*';
	g[3011][3014] = '*';
	g[5000][5000] = '*';	
	
	bfs();
	
	int ans = 0;
	for (int i = 0; i < 10000; i ++)
		for (int j = 0; j < 10000; j ++)
			if(g[i][j] == '*') ans ++;
			
	cout << ans << endl;
	return 0;			
} 
